package com.zmx.common.common.enums;

/**
 * @Description: 订单状态、支付状态、发货状态、退货状态
 * @Author zhaomxr
 * @Date 2022-01-01 13:37
 */
public class Enum {

    public enum OrderStatus {
        unconfirmed(0, "未确认"),
        confirmed(1, "已确认"),
        completed(2, "已完成"),
        canceled(3, "已取消"),
        incancel(4, "取消中"),
        reject(5, "拒收"),
        rejected(6, "拒收入库");

        private int code;
        String message;

        OrderStatus(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }

        public static OrderStatus getByCode(int code) {
            for (OrderStatus orderStatus : OrderStatus.values()) {
                if (orderStatus.getCode() == code) {
                    return orderStatus;
                }
            }
            return null;
        }
    }

    public enum PaymentStatus {
        unpaid(0, "未支付"),
        paid(1, "已支付"),
        refunded(2, "已退款");

        private int code;
        String message;

        PaymentStatus(int code, String message) {
            this.code = code;
            this.message = message;
        }
        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }

        public static PaymentStatus getPaymentStatusByCode(int code){
            for (PaymentStatus paymentStatus:PaymentStatus.values()){
                if(paymentStatus.getCode() == code){
                    return paymentStatus;
                }
            }
            return null;
        }
    }

    public enum DeliveryStatus {
        undelivery(0, "未发货"),
        delivery(1, "已发货"),
        returned(2, "已退货");

        private int code;
        String message;

        DeliveryStatus(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }
    }

    public enum orderLogType {
        serviceCancel(0, "到期系统自动取消"),
        customerCancel(1, "客户自主取消");

        private int code;
        String message;

        orderLogType(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }
    }

    public enum refundStatus {
        cancel(-1, "取消"),
        audit(0, "处理中"),
        success(1, "已完成"),
        abnormal(2, "异常");

        private int code;
        String message;

        refundStatus(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }
    }

    public enum refundSingStatus {
        audit(0, "待审核"),
        refundof(1, "退款中"),
        success(2, "已退款"),
        rejected(3, "驳回");

        private int code;
        String message;

        refundSingStatus(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }
    }


}
